#ifndef VIDEOPLUGIN_H
#define VIDEOPLUGIN_H

#include <QObject>
#include <Maestro/mcplugins.h>
#include <phonon>

class VideoPlugin : public FileSelectionInterface {
    Q_OBJECT
    Q_INTERFACES(MenuItemInterface)
    Q_INTERFACES(FileSelectionInterface)
public:
    VideoPlugin();
    QString getName();
    QIcon getImage();
    QIcon getIcon(MediaFile * mediaFile);
    QStringList getExtensions();
    void test();
    QWidget * getInterface();
    void setMediaFile(MediaFile * mediaFile);
    void setMediaQueue(QList<MediaFile *> * files, int start=0);
    bool isPlaying();
    bool setSlider(Phonon::SeekSlider * slider);
public slots:
    void play();
    void fastForward();
    void rewind();
    void stop();
    void setVolume(int volume);
    void next();
    void previous();
    void stateChange(Phonon::State oldS, Phonon::State newS);
    void mediaSourceChanged(Phonon::MediaSource source);
    //void aboutToFinish();
    void setShuffleState(bool shuffleState);
    void setRepeatState(int repeatState);

signals:
    void stateChanged(bool); //if true the object is playing
    void error(QString errorMessage);
    void fileChanged(QString name, int index, int total);
private slots:
    void ff();
    void rw();
    void dataChanged();
    void aboutToFinish();
    void finished();
private:
    int index;
    Phonon::MediaObject * mediaObject;
    Phonon::VideoWidget * player;
    Phonon::AudioOutput *audioOutput;
    QList<Phonon::MediaSource> queue;
    QList<Phonon::MediaSource> tmpQueue;
    QList<MediaFile *> * files;
    QTimer * ffTimer;
    QTimer * rwTimer;
    bool acceleratedMute;
    int repeat;
    bool shuffle;
};

#endif // VIDEOPLUGIN_H
